package com.example.yls.demoa;

import android.animation.ValueAnimator;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

public class MainActivity extends AppCompatActivity {
    private myView myview;

    private static final String TAG ="MainActivity" ;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
       myview=findViewById(R.id.btn_myView);
        findViewById(R.id.btn_start).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ValueAnimator valueAnimator=ValueAnimator.ofFloat(0,200);
                valueAnimator.setDuration(3000);
                valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                    @Override
                    public void onAnimationUpdate(ValueAnimator valueAnimator) {
                     float value= (float) valueAnimator.getAnimatedValue();
                        Log.e(TAG,"value="+value);
                        myview.setCenter(value);
                    }
                });
                valueAnimator.start();
                ValueAnimator valueAnimator2=ValueAnimator.ofFloat(0,500);
                valueAnimator2.setDuration(3000);
                valueAnimator2.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                    @Override
                    public void onAnimationUpdate(ValueAnimator valueAnimator) {
                        float value= (float) valueAnimator.getAnimatedValue();
                        Log.e(TAG,"value="+value);
                        myview.setRadius(value);
                    }
                });
                valueAnimator2.start();
            }
        });
    }
}
